<?php

require("../function/util.php");
$id = $_GET['id'];

$sql = "SELECT * FROM news WHERE news_id = " . $id;
$result = mysql_fetch_assoc(runSQL($sql));

?>

<link type="text/css" href="../css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="../plugin/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
    function fancyboxClose(){
        $.fancybox.close();
        $("#flex1").flexReload();
    }
</script>
<script>
    $(function() {
        $("#broadcast_date").datepicker();
        $("#start_date_time_date").datepicker();
        $("#end_date_time_date").datepicker();
    });
</script>
<style type="text/css">
    .ui-datepicker{
        width:150px;
        font-family:tahoma;
        font-size:11px;
        text-align:center;
    }
</style>

<div class="main-content resize" id="data" style="width:900px;">
    <h1>Modify News</h1>
    <p></p>
    <br clear="all" />
    <form name="frm" method="post" action="edit.php" enctype="multipart/form-data" target="ifrm">

		<input type="hidden" name="news_id" value="<?= $id ?>" />
		
        <div id="error" style="color:#ff0000"></div>
        <table cellpadding="0" cellspacing="0" border="0">

			<tr>
                <td class="label" style="width:250px;"><label for="news_weight">Weight</label></td>
                <td class="field">
                    <textarea id="news_weight" name="news_weight" rows="1" size="20" style='overflow:hidden;width:400px' tabindex="1"><?= stripslashes($result['news_weight']); ?></textarea>
                </td>
            </tr>
			<tr>
                <td class="label" style="width:250px;"><label for="news_date">Date</label></td>
                <td class="field">
                    <textarea id="news_date" name="news_date" rows="1" size="20" style='overflow:hidden;width:400px' tabindex="1"><?= stripslashes($result['news_date']); ?></textarea>
                </td>
            </tr>			
            <tr>
                <td class="label"><label for="news_topic">Topic</label></td>
                <td class="field">
                    <textarea id="news_topic" name="news_topic" size="20" style='width:400px;height:80px' tabindex="1"><?= stripslashes($result['news_topic']); ?></textarea>
                </td>
            </tr>
            <tr>
                <td class="label"><label for="news_detail">Detail</label></td>
                <td class="field">
                    <textarea id="news_detail" name="news_detail" size="20" style='width:400px;height:80px' tabindex="1"><?= stripslashes($result['news_detail']); ?></textarea>
                </td>
            </tr>			
			<tr>
			<tr>
				<td class="label"><label for="news_status">Status</label></td>
				<td class="field">
					<select name="news_status" id="news_status">
						<?php
						if (stripslashes($result['news_status']) == "1")
						{
							echo "<option value=\"1\" selected=\"selected\">Active</option>";
							echo "<option value=\"0\">Inactive</option>";
						} else
						{
							echo "<option value=\"1\">Active</option>";
							echo "<option value=\"0\" selected=\"selected\">Inactive</option>";						
						}
						?>
					</select>
				</td>
			</tr>
		
            <tr>			
                <td></td>
                <td>
                    <div class="buttonSubmit">
                        <span></span>
                        <input type="submit" value="Submit" style="width: 100px" tabindex="14" />
                        <input type="button" value="Cancel" style="width: 100px" tabindex="15" onClick="fancyboxClose();" id="cancel_button"/>
                        <input type="button" value="Reset Form" style="width: 100px" onClick="this.form.reset()"  tabindex="15" />
                    </div>
                </td>
            </tr>			
			
        </table> 
    </form>
    <iframe name="ifrm" style="display:none;"> </iframe>
</div>	<!-- end main content  --> 